// 这道题, 其实不难, 主要是考察字符串的操作, 以及二维数组的遍历
// 双for , 可能会超时, 百万级别
// 优化, 一层for
const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let n;
let strArr;
rl.on("line", (line)=>{
    if(n === undefined) {
        [strArr, n] = line.trim().split(" ")
        strArr = strArr.split("");
        getResult(strArr, Number(n))

        // clear
        n = undefined;
        strArr = undefined;
    }

})

/**
 *
 * @param strArr {[string]} 字符数组
 * @param n {number} 空地宽度
 * @return {void}
 */
function getResult(strArr, n) {
    const box = new Array(n).fill(0).map(() => new Array())
    let reverse = true
    for (let i = 0; i < strArr.length; i++) {
        let k = i % n
        if(k === 0) reverse = !reverse;
        if(reverse) k = n - 1 - k
        box[k].push(strArr[i])
    }

    for (let i = 0; i < box.length; i++) {
        let arr = box[i]
        console.log(arr.join(""))
    }

}